package cn.edu.scau.cmi.dengzejun.chapter04;

public class PerfectNumber {
	public static void main(String agr[]) {
		for (long i=1;i<=1000;i++) {
			long sum=0;
			for (long j=i;j>=i/2&&j!=0;j--) {
				
				if (i%j==0) {
					sum+=((j==(i/j))||(i==j)?(i/j):(j+(i/j)));
				}
			}
			if (i==sum) {
				System.out.println(i);
			}
		}
	}
}
